<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?
	if (sizeof($basket) > 0) {
		?>
		<table cellspacing='0' cellpadding='0' class='basket_table'>
			<tr>
				<th>#</th>
				<th>Название</th>
				<th>Размер</th>
				<th>Количество</th>
				<th>Цена</th>
				<th>Сумма</th>
			</tr>
		<?
		$i = 0;
		foreach ($basket as $key => $item) {
			$catalog_item = $this->db->select()->from('catalog_items')->where('item_id', $key)->get()->row_array();
			$prices = $this->basket_model->parse_prices($catalog_item['item_sizes']);
			$i++;
			echo "<tr>";
				echo "<td>";
					echo $i;
				echo "</td>";
				echo "<td>";
					echo $item['name']." [".$item['number']."]";
				echo "</td>";
				echo "<td>";
					echo "Цвета: ".implode(", ", $item['color']);
				echo "</td>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
				echo "</td>";
			echo "</tr>";
			foreach ($item['size'] as $size => $count) {
				$this_price = $prices[$size] * $count;
				echo "<tr>";
					echo "<td>";
					echo "</td>";
					echo "<td>";
					echo "</td>";
					echo "<td>";
					echo $size;
					echo "</td>";
					echo "<td>";
						echo $count;
					echo "</td>";
					echo "<td>";
						echo tonum($prices[$size]);
					echo "</td>";
					echo "<td>";
						echo tonum($this_price);
					echo "</td>";
				echo "</tr>";
			}
			echo "<tr class='td-underline'>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
					echo $item['count'];
				echo "</td>";
				echo "<td>";
				echo "</td>";
				echo "<td>";
					echo tonum($item['sum']);
				echo "</td>";
			echo "</tr>";

		}
		echo "</table>";
	} else {
		showmenotice('Пустой заказ!!!');
	}
?>